package org.myname.example1;

import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionActivationListener;
import javax.servlet.http.HttpSessionEvent;

/**
 * Application Lifecycle Listener implementation class TestHttpSessionActivationListener
 *
 */
@WebListener
public class TestHttpSessionActivationListener implements HttpSessionActivationListener {

    /**
     * Default constructor. 
     */
    public TestHttpSessionActivationListener() {
        // TODO Auto-generated constructor stub
    }

	/**
     * @see HttpSessionActivationListener#sessionDidActivate(HttpSessionEvent)
     */
    public void sessionDidActivate(HttpSessionEvent event)  { 
    	HttpSession session =event.getSession();
    	System.out.println(session.getId()+"session did created");
    }

	/**
     * @see HttpSessionActivationListener#sessionWillPassivate(HttpSessionEvent)
     */
    public void sessionWillPassivate(HttpSessionEvent event)  { 
    	HttpSession session =event.getSession();
    	System.out.println(session.getId()+"session did destroyed");
    }
	
}
